#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {

    for (size_t i = 1000; i <= 9999; i++)
    {
        int g = i % 10;
        int s = i / 10 % 10;
        int b = i / 100 % 10;
        int q = i / 1000 % 10;

        int bt = s * 10 + g;
        int at = q * 10 + b;

        if(pow((bt+at),2)==i)
            printf("%d ", i);
    }
    


    return 0;
}